package com.example.flinkcourse.lesson1.transform;

import org.apache.flink.api.common.functions.FilterFunction;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 自定义 Filter 转换函数
 * 用于基于条件过滤数据
 */
public class MyFilterFunction implements FilterFunction<String> {
    private static final Logger LOG = LoggerFactory.getLogger(MyFilterFunction.class);

    @Override
    public boolean filter(String value) throws Exception {
        LOG.debug("Filtering record: {}", value);
        
        // 示例：过滤掉空字符串和长度小于3的字符串
        boolean result = value != null && !value.isEmpty() && value.length() >= 3;
        
        LOG.debug("Filter result for {}: {}", value, result);
        return result;
    }
} 